<!DOCTYPE html>
<head>
    <title>秒杀详情页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <!-- jquery -->
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <!-- bootstrap -->
    <link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap.min.css" />
    <script type="text/javascript" src="/bootstrap/js/bootstrap.min.js"></script>
    <!-- jquery-validator -->
    <script type="text/javascript" src="/jquery-validation/jquery.validate.min.js"></script>
    <script type="text/javascript" src="/jquery-validation/localization/messages_zh.min.js"></script>
    <!-- layer -->
    <script type="text/javascript" src="/layer/layer.js"></script>
    <!-- md5.js -->
    <script type="text/javascript" src="/js/md5.min.js"></script>
    <!-- common.js -->
    <script type="text/javascript" src="/js/common.js"></script>
</head>
<body>
<div class="panel panel-success">
    <div class="panel-title">秒杀订单详情</div>
    <div class="panel-body">
        <table class="table" id="goodslist">
            <tr>
                <td>商品名称</td>
                <td id="goodsName"></td>
            </tr>
            <tr>
                <td>商品图片</td>
                <td colspan="2"><img id="goodsImg" width="100" height="100"></td>

            </tr>
            <tr>
                <td>订单价格</td>
                <td id="goodsPrice"></td>
            </tr>
            <tr>
                <td>下单时间</td>
                <td id="createDate" colspan="2"></td>
            </tr>
            <tr>
                <td>订单状态</td>
                <td id="orderStatus">
                </td>
                <td>
                    <button class="btn btn-primary btn-block" type="submit" id="payButton">立即支付</button>
                </td>
            </tr>
            <tr>
                <td>收货人</td>
                <td colspan="2" id="userId"></td>
            </tr>
            <tr>
                <td>收货地址</td>
                <td>西安邮电大学 长安校区</td>
            </tr>
        </table>
    </div>
</div>

</body>
<script>
    $(function () {
        getOrderDetail();
    });
    function render(orderVo) {
        var goods=orderVo.goodsVo;
        var order=orderVo.orderInfo;
        $("#goodsName").text(goods.goodsName);
        $("#goodsImg").attr("src",goods.goodsImg);
        $("#goodsPrice").text(order.goodsPrice);
        var status="";
        if(order.status==0){
            status="未支付";
        }else if(order.status==1){
            status="待发货";
        }
        $("#orderStatus").text(status);
        $("#createDate").text(new Date(order.createDate)).format("yyyy-MM-dd hh:mm:ss");
    }

    function getOrderDetail() {
        var orderId = g_getQueryString("orderId");
        $.ajax({
            url:"/order/detail",
            type:"GET",
            data:{
                orderId:orderId
            },
            success:function (data) {
                if(data.code==0){
                    render(data.data);
                }else {
                    layer.msg(data.msg)
                }
            },
            error:function () {
                layer.msg("客户端请求有误");
            }
        })
    }
</script>
</html>